package com.sunstar.cwcamerademo

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import com.gitee.sunstar.adblib.ADBHelper
import com.hjjt.cameralib.CameraHelperImpl
import com.hjjt.cameralib.CameraInstance
import com.hjjt.cameraplugin.CameraEngineConfig


class MainActivity : AppCompatActivity() {

    private val testViewModel = TestViewModel.instance

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        DSHelper.appContext = applicationContext
        startFaceRecognise()

//        CameraHelperImpl.cameraOpenSuccess = {
//            Log.e("Splash", "openSuccess")
//        }
    }


    private fun startFaceRecognise() {
        Log.e("MainActivity", "startFaceRecognise: ")
        CameraHelperImpl().openCamera(
            CameraEngineConfig.CameraEngineType.CLOUD_WALK,
            this,
            R.id.frame,
            CameraEngineConfig.Angle.ANGLE_0
        ) { code, message, data ->
//            Handler(mainLooper).postDelayed({ finish() },3000)
            if (code == 0) { //活检成功
                Log.e("MainActivity", "startFaceRecognise: 活的", )
            } else if (code == -1) { //修改姿势
                Log.e("MainActivity", "startFaceRecognise: 死的", )
//                ageCheckVM.recognizerError()
            }
        }
    }
}